package com.oro.backingbeans;

import java.util.ArrayList;
import java.util.Collection;

import javax.annotation.PostConstruct;

import org.apache.log4j.Logger;

import com.oro.domain.Sede;
import com.oro.domain.test.Foo;

public class TestBean {

	private static final Logger logger = Logger
			.getLogger(InserisciUtenteBean.class);
	private Collection<Sede> branches;
	private Sede branchInput;
	private Collection<Foo> foos;

	private Foo tempFoo = new Foo();

	public TestBean() {

	}

	public void add() {
		// foos.add(new Foo(tempFoo.getTemp()));
		foos.add(tempFoo);
		tempFoo = new Foo();
	}

	public void addNewBranch() {
		// System.out.println("ADD NEW BRANCH!");
		// branchInput.setSchool(schoolInput);
		// schoolInput.add(branchInput);
		// branchInput = new Sede();
		branches.add(branchInput);
		branchInput = new Sede();

	}

	public Collection<Sede> getBranches() {
		return branches;
	}

	public Sede getBranchInput() {
		return branchInput;
	}

	public Collection<Foo> getFoos() {
		return foos;
	}

	private Logger getLogger() {
		return logger;
	}

	public Foo getTempFoo() {
		return tempFoo;
	}

	@PostConstruct
	public void postConstruct() {
		tempFoo = new Foo();
		setBranchInput(new Sede());
		foos = new ArrayList<Foo>();
		branches = new ArrayList<Sede>();
		getLogger().info("Test Bean has been sonstructed");
	}

	public void setBranches(Collection<Sede> branches) {
		this.branches = branches;
	}

	public void setBranchInput(Sede branchInput) {
		this.branchInput = branchInput;
	}

	public void setFoos(Collection<Foo> foos) {
		this.foos = foos;
	}

	public void setTempFoo(Foo tempFoo) {
		this.tempFoo = tempFoo;
	}

}
